<%@ page import="com.raise.drive.model.domain.Vehicle" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jspf/include.jspf" %>

<%--@elvariable id="instructorForm" type="com.raise.drive.web.form.InstructorForm"--%>
<%--@elvariable id="dateFormat" type="java.lang.String"--%>

<tiles:insertDefinition name=".base">

<tiles:putAttribute name="pageTitle">
    <fmt:message key="page.confirmInfo.title"/>
</tiles:putAttribute>

<tiles:putAttribute name="javascript">
    <script type="text/javascript">
        // <![CDATA[

        // ]]>
    </script>
</tiles:putAttribute>

<tiles:putAttribute name="menu">
    <%@ include file="/WEB-INF/jspf/anonymousMenu.jspf" %>
</tiles:putAttribute>

<tiles:putAttribute name="body">

    <p>
        <fmt:message key="page.confirmInfo.description"/>
    </p>

    <form:form commandName="instructorForm">

        <table>
            <tr>
                <td>
                    <fmt:message key="entity.instructor.name"/>
                </td>
                <td>
                        ${instructorForm.instructor.name}
                </td>
            </tr>
            <tr>
                <td>
                    <fmt:message key="entity.instructor.surname"/>
                </td>
                <td>
                        ${instructorForm.instructor.surname}
                </td>
            </tr>
            <tr>
                <td>
                    <fmt:message key="entity.instructor.patronymic"/>
                </td>
                <td>
                        ${instructorForm.instructor.patronymic}
                </td>
            </tr>
            <tr>
                <td>
                    <fmt:message key="entity.instructor.sex"/>
                </td>
                <td>
                    <fmt:message key="entity.instructor.sex.${instructorForm.instructor.sex}"/>
                </td>
            </tr>
            <tr>
                <td>
                    <fmt:message key="entity.instructor.sinceYear"/>
                </td>
                <td>
                        ${instructorForm.instructor.sinceYear}
                </td>
            </tr>
            <tr>
                <td>
                    <fmt:message key="entity.instructor.description"/>
                </td>
                <td>
                    <spring:bind path="instructorForm.instructor.description">
                        <textarea rows="5" cols="25" name="${status.expression}"
                                  readonly="readonly">${status.value}</textarea>
                    </spring:bind>
                </td>
            </tr>

                <%-- cars --%>
            <tr>
                <td>
                    <fmt:message key="entity.vehicle.vendor"/>
                </td>
                <td>
                        ${instructorForm.vehicle.vendor}
                </td>
            </tr>
            <tr>
                <td>
                    <fmt:message key="entity.vehicle.model"/>
                </td>
                <td>
                        ${instructorForm.vehicle.model}
                </td>
            </tr>
            <tr>
                <td>
                    <fmt:message key="entity.vehicle.gearBox"/>
                </td>
                <td>
                    <fmt:message key="entity.vehicle.gearBox.${instructorForm.vehicle.gearBox}"/>
                </td>
            </tr>
            <tr>
                <td>
                    <fmt:message key="entity.vehicle.pricePerHour"/>
                </td>
                <td>
                        ${instructorForm.vehicle.pricePerHour}
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <form:checkbox path="vehicle.additionalPedals" disabled="true"/><fmt:message
                        key="entity.vehicle.additionalPedals"/>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <form:checkbox path="vehicle.additionalMirrors" disabled="true"/><fmt:message
                        key="entity.vehicle.additionalMirrors"/>
                </td>
            </tr>

                <%-- Additional vehicles --%>
            <c:forEach begin="0" end="9" step="1" varStatus="varStatus">
                <tr>
                    <td colspan="2">
                        <table width="100%" id="additionalCar-${varStatus.index}" style="display:none;">
                            <tr>
                                <td colspan="2">
                                    <hr/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <fmt:message key="entity.vehicle.vendor"/>
                                </td>
                                <td>
                                        ${instructorForm.additionalVehicles[varStatus.index].vendor}
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <fmt:message key="entity.vehicle.model"/>
                                </td>
                                <td>
                                        ${instructorForm.additionalVehicles[varStatus.index].model}
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <fmt:message key="entity.vehicle.gearBox"/>
                                </td>
                                <td>
                                    <fmt:message
                                            key="entity.vehicle.gearBox.${instructorForm.additionalVehicles[varStatus.index].gearBox}"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <fmt:message key="entity.vehicle.pricePerHour"/>
                                </td>
                                <td>
                                        ${instructorForm.additionalVehicles[varStatus.index].pricePerHour}
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    <form:checkbox disabled="true"
                                                   path="additionalVehicles[${varStatus.index}].additionalPedals"/><fmt:message
                                        key="entity.vehicle.additionalPedals"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    <form:checkbox disabled="true"
                                                   path="additionalVehicles[${varStatus.index}].additionalMirrors"/><fmt:message
                                        key="entity.vehicle.additionalMirrors"/>
                                </td>
                            </tr>
                        </table>
                        <script type="text/javascript">

                            if (${instructorForm.usedVehicle[varStatus.index]}) {
                                $('additionalCar-${varStatus.index}').style.display = 'block';
                            }

                        </script>
                    </td>
                </tr>
            </c:forEach>

            <tr>
                <td colspan="2">
                    <tags:submit key="common.back" name="_target1"/>
                    <tags:submit key="page.confirmInfo.registerInstructor" name="_finish"/>
                    <tags:submit key="common.cancel" name="_cancel"/>
                </td>
            </tr>

        </table>
    </form:form>

</tiles:putAttribute>

</tiles:insertDefinition>
